<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:51:"D:\phpStudy\WWW\crm/app/index\view\orders\edit.html";i:1513238600;s:44:"D:\phpStudy\WWW\crm/app/index\view\base.html";i:1512719636;}*/ ?>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>山东归仁生物科技有限公司<?php echo HTRConf('CONF.appName'); ?></title>
<meta name="Keywords" content=""/>
<meta name="Description" content=""/> 
<link href="__INDEX__/js/ligerui/skins/Aqua/css/ligerui-all.css?v=<?php echo $v; ?>" rel="stylesheet" type="text/css" /> 
<link href="__STATIC__/plugins/validator/jquery.validator.css?v=<?php echo $v; ?>" rel="stylesheet">

<link href="__INDEX__/css/style.css?v=<?php echo $v; ?>" rel="stylesheet" type="text/css" />   
<script src="__STATIC__/js/jquery.min.js?v=<?php echo $v; ?>"></script>  
<script src="__INDEX__/js/ligerui/js/ligerui.all.js?v=<?php echo $v; ?>" type="text/javascript"></script> 
<script type='text/javascript' src='__STATIC__/plugins/layer/layer.js?v=<?php echo $v; ?>'></script> 
<script src="__STATIC__/js/common.js?v=<?php echo $v; ?>"></script>
<script>
window.conf = {"ROOT":"__ROOT__","APP":"__APP__","STATIC":"__STATIC__","SUFFIX":"<?php echo config('url_html_suffix'); ?>","USER_LOGO":"<?php echo HTRConf('CONF.userLogo'); ?>",'GRANT':'<?php echo implode(",",session("HTR_STAFF.privileges")); ?>'}
</script>
<script src="__INDEX__/js/common.js?v=<?php echo $v; ?>"></script>
<script type="text/javascript" src="__STATIC__/plugins/validator/jquery.validator.js?v=<?php echo $v; ?>"></script>
<script type="text/javascript" src="__STATIC__/plugins/validator/local/zh-CN.js?v=<?php echo $v; ?>"></script>
</head>
<body>

<div class="l-loading" style="display: block" id="htr-loading"></div>
<form id='editFrom' autocomplete='off'>
<input type='hidden' id='user_id' class='ipt' value="<?php echo $object['user_id']; ?>"/>
<input type='hidden' id='user_name' class='ipt' value="<?php echo $object['user_name']; ?>"/>
<input type='hidden' id='areaIdPath' class='ipt' value="<?php echo $object['areaIdPath']; ?>"/>
<input type='hidden' id='areaId' class='ipt' value="<?php echo $object['areaId']; ?>"/>
<input type='hidden' id='user_address' class='ipt' value="<?php echo $object['user_address']; ?>"/>
<input type='hidden' id='staffId' class='ipt' value="<?php echo $object['staffId']; ?>"/>
<input type='hidden' id='orderId' class='ipt' value="<?php echo $object['orderId']; ?>"/>
<input type='hidden' id='goodsId' class='ipt' value="<?php echo $object['goodsId']; ?>"/>
<input type='hidden' id='shopId' class='ipt' value="<?php echo $object['shopId']; ?>"/>
<input type='hidden' id='goodsName' class='ipt' value="<?php echo $object['goodsName']; ?>"/>
<input type='hidden' id='salePrice' class='ipt' value="<?php echo $object['salePrice']*1; ?>"/>
<table class='htr-form htr-box-top'>
  <tr>
     <th width='150'>客户手机<font color='red'>*</font>：</th>
     <td><input type="text" id='user_phone' class='ipt' value="<?php echo $object['user_phone']; ?>" maxLength='20' data-rule="客户手机: required"/></td>
  </tr>
  <tr class="user_name" style="display:none">
     <th>客户姓名<font color='red'> </font>：</th>
     <td></td>
  </tr>
  <tr>
     <th>产品编号<font color='red'>*</font>：</th>
     <td><input type="text" id='goodsSn' class='ipt' value="<?php echo $object['goodsSn']; ?>" maxLength='20' data-rule="产品编号: required"/></td>
  </tr>
  <tr class="goodsName" style="display:none">
     <th>产品名称<font color='red'> </font>：</th>
     <td></td>
  </tr>
  <tr class="salePrice" style="display:none">
     <th>产品售价<font color='red'> </font>：</th>
     <td></td>
  </tr>
  <tr>
     <th>产品数量<font color='red'>*</font>：</th>
     <td><input type="text" id='saleNum' class='ipt' value="<?php echo $object['saleNum']; ?>" maxLength='20' data-rule="产品数量: required"/></td>
  </tr>
  <tr class='total' style="display:none">
     <th>订单总额<font color='red'> </font>：</th>
     <td><?php echo $object['total']; ?></td>
  </tr>
  <tr>
    <th>疾病类型<font color='red'>*</font>：</th>
    <td> 
      <select id="diseaseId" name='diseaseId' class='ipt' data-rule="疾病类型: required"/>
        <option value="">-请选择-</option>    
        <?php if(is_array($diseaseList) || $diseaseList instanceof \think\Collection): $i = 0; $__LIST__ = $diseaseList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
        <option value="<?php echo $vo['diseaseId']; ?>"<?php if($object['diseaseId']==$vo['diseaseId']): ?> selected<?php endif; ?>><?php echo $vo['diseaseName']; ?></option>
        <?php endforeach; endif; else: echo "" ;endif; ?>
      </select>
    </td>
  </tr>
  <tr>
    <th>消费时间<font color='red'>*</font>：</th>
    <td>
      <input type="text" class="ipt" id="createTime" name="createTime" value="<?php echo $object['createTime']; ?>" data-rule="消费时间: required" />
    </td>
  </tr>
  <tr>
    <th>未消费提醒<font color='red'> </font>：</th>
    <td colspan='3'> 
      <label><input type="checkbox" class="ipt" name="remind"<?php echo in_array(100,explode(',',$object['remind'])) ? ' checked' : ''?> value="100" />100天</label>
      <label><input type="checkbox" class="ipt" name="remind"<?php echo in_array(200,explode(',',$object['remind'])) ? ' checked' : ''?> value="200" />200天</label>
      <label><input type="checkbox" class="ipt" name="remind"<?php echo in_array(300,explode(',',$object['remind'])) ? ' checked' : ''?> value="300" />300天</label>
      <label><input type="checkbox" class="ipt" name="remind"<?php echo in_array(365,explode(',',$object['remind'])) ? ' checked' : ''?> value="365" />365天</label>
    </td>
  <tr>
  <tr>
     <td colspan='2' align='center'>
       <input type='button' value='保存' class='btn btn-blue' onclick='javascript:save()'>
       <input type='button' value='返回' class='btn' onclick='javascript:history.go(-1)'>
     </td>
  </tr>
</table>
</form>
<script>
$(function(){  
  <?php if($object['user_phone']): ?>check_phone();<?php endif; if($object['goodsSn']): ?>check_goods();<?php endif; if($object['saleNum']): ?>calculate_total();<?php endif; ?>
  $('#user_phone').blur(function(){
    check_phone();
  });
  function check_phone(){
    var user_phone = $('#user_phone').val();
    $('.user_name').hide();
    if(user_phone){
      $.post(HTR.U('index/orders/check_phone'),{user_phone:user_phone},function(data,textStatus){
        var json = HTR.toIndexJson(data);
        if(json.status=='1'){
          $('.user_name').show().find('td').html(json.data.user_name);
          $('#user_id').val(json.data.user_id);          
          $('#user_name').val(json.data.user_name);      
          $('#areaIdPath').val(json.data.areaIdPath);      
          $('#areaId').val(json.data.areaId);   
          $('#user_address').val(json.data.user_address);      
          $('#staffId').val(json.data.staffId);          
          $('#shopId').val(json.data.shopId);  
        }else{
          HTR.msg(json.msg,{icon:2});
        }
      });      
    }
  }
  $('#goodsSn').blur(function(){
    check_goods();
  });
  function check_goods(){
    var goodsSn = $('#goodsSn').val();
    $('.goodsName').hide();
    $('.salePrice').hide();
    if(user_phone){
      $.post(HTR.U('index/orders/check_goods'),{goodsSn:goodsSn},function(data,textStatus){
        var json = HTR.toIndexJson(data);
        if(json.status=='1'){
          $('.goodsName').show().find('td').html(json.data.goodsName);
          $('.salePrice').show().find('td').html(json.data.salePrice+'元');
          $('#goodsId').val(json.data.goodsId);          
          $('#goodsName').val(json.data.goodsName);          
          $('#salePrice').val(json.data.salePrice);     
          $('.total').find('td').html(parseInt($('#saleNum').val())*parseFloat(json.data.salePrice)+'元');      
        }else{
          HTR.msg(json.msg,{icon:2});
        }
      });      
    }
  }
  $('#saleNum').blur(function(){
    var num = $(this).val();
    var salePrice = $('#salePrice').val();   
    $('.total').show().find('td').html(parseInt(num)*parseFloat(salePrice));   
  });
  function calculate_total(){
    var num = $('#saleNum').val();
    var salePrice = $('#salePrice').val();   
    $('.total').show().find('td').html(parseInt(num)*parseFloat(salePrice)+'元');   
  }

  $("#createTime").ligerDateEditor();
})
</script>


<script src="__INDEX__/orders/orders.js?v=<?php echo $v; ?>" type="text/javascript"></script>

<script>
function showImg(opt){
	layer.photos(opt);
}
function showBox(opts){
	return HTR.open(opts);
}
</script>
</body>
</html>